/*
 * author      : dormi330
 * date        : 2018/7/16
 * description : 添加 退款类型
 */

package com.deep.trade.domain.refund;

import com.deep.trade.adaptor.required.catalog.Catalog;
import com.deep.trade.common.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CommandAddRefundType {

    @Autowired
    private RefundRepository refundRepository;

    public void addRefundType(Catalog catalog, Long code, String name) {
        RefundType refundType = new RefundType();
        refundType.setId(CommonUtils.uuid());
        if (null != catalog) refundType.setCatalogId(catalog.getId());
        refundType.setTypeCode(code);
        refundType.setTypeName(name);

        refundRepository.insertRefundType(refundType);
    }

}
